﻿using System;
using System.Net.Sockets;
using System.Collections;
using System.Collections.Generic;
using System.Threading;
using System.IO;
using System.Text;

namespace ACEMUD
{
    public class MultipleUsers : List<User>
    { }

    public class User
    {
        // Properties
        static object BigLock = new object();               // The lock for the user so bad threading stuff doesn't happen.
        public Socket Socket { get; set; }                                      // The socket the user is connected via.

        public string Name { get; set; }                    // The name of the user.
        public uint Room { get; set; }                      // The room number the user is in.

        public StreamReader Reader;                         // Input from the user.
        public StreamWriter Writer;                         // Output to the user.
        static ArrayList Users = new ArrayList();           // An ArrayList containing all the open connectsions
        public string line { get; set; }

        public const int BufferSize = 1024;
        // Receive buffer.
        public byte[] buffer = new byte[BufferSize];
        // Received data string.
        public StringBuilder sb = new StringBuilder();


        // Constructor
        public User(Socket socket)
        {
            this.Socket = socket;
            Reader = new StreamReader(new NetworkStream(socket, false));
            Writer = new StreamWriter(new NetworkStream(socket, true));
            
            this.Name = "";
        }
    }
}
